<html>
	<head>
    <meta http-equiv="Content-Type"content="text/html; charset=UTF-8">
    <meta name="viewport"content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable"content="yes">
    <meta name="apple-mobile-web-app-status-bar-style"content="black">
    <meta name="format-detection"content="telephone=no">
    <link rel="stylesheet" href="__STATIC__/vendor/bootstrap/css/bootstrap.min.css">
    <script src="__STATIC__/jquery/jquery.min.js"></script>
    <script src="__STATIC__/layer/layer.js"></script>
    <style type="text/css">
		*{ padding:0; margin:0;}
    	.payHead{  padding:10px; text-align:center; }
		.payHead .span1{ font-size:16px;}
		.payHead .price{ font-size:16px; line-height:40px; font-weight:bold;}
		.button{ color:#fff; font-size:16px; background:#E62A33; border-radius:5px; padding:12px 0; text-align:center; display:block; margin:20px; -webkit-appearance:none; border:none; text-decoration:none;}
        #author{color: #E62A33;}
        #author:link {color: #E62A33 !important}
        #author:visited {color: #E62A33 !important}
        #author:hover {color: #E62A33 !important}
        #author:active {color: #E62A33 !important}
    </style>
<!--    <script src="__STATIC__/jquery/jquery.min.js"></script>-->
    <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <title>微信支付</title>
   
    <script type="text/javascript">
		//调用微信JS api 支付
		function jsApiCall()
		{
			WeixinJSBridge.invoke(
				'getBrandWCPayRequest',
				{$jsApiParameters},
				function(res){
				    console.log('jsApiCall',res);
					WeixinJSBridge.log(res.err_msg);

                    if(res.err_msg == "get_brand_wcpay_request:ok"){
                        window.location.href="{:url('pay/weixin/pResult',['id'=>$order.id])}";
                    }else if(res.err_msg == "get_brand_wcpay_request:cancel"){
                        // alert("用户取消支付!");
                    }else{
                        // alert("支付失败!" + JSON.stringify(res));
                    }
				}
			);
		}

		function callpay()
		{
			if (typeof WeixinJSBridge == "undefined"){
			    if( document.addEventListener ){
			        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
			    }else if (document.attachEvent){
			        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
			        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
			    }
			}else{
			    jsApiCall();
			}
		}

    </script>
</head>

<body>
	<div style="margin-top: 45%;">
    	<div class="payHead">
            <span class="span1">{$product->title}</span><br/>
            <span class="price">金额 : {$order.totalFee/100}元</span>
        </div>

        <div class="footReturn" id="payDom" style="margin-top: 100px;">
        	<a href="javascript:void(0);" class="button" onClick="callpay()" >点击进行微信支付</a>
        </div>
    </div>
</body>
</html>